using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ObjectMapper.Benchmark.DataModel
{
    internal class PersonCreditCardConfiguration : EntityTypeConfiguration<PersonCreditCard>
    {
        public PersonCreditCardConfiguration()
        {
            ToTable("Sales.PersonCreditCard");
            HasKey(x => new {x.BusinessEntityId, x.CreditCardId});

            Property(x => x.BusinessEntityId)
                .HasColumnName("BusinessEntityID")
                .IsRequired()
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
            Property(x => x.CreditCardId)
                .HasColumnName("CreditCardID")
                .IsRequired()
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
            Property(x => x.ModifiedDate).HasColumnName("ModifiedDate").IsRequired();
        }
    }
}